Omplus.base.define(Omplus.models.Model, {
	omplusName : "ReturnedFormsSearch",
	controller : "formsController",
	value : {
		delta : {
			omplusType : "Number",
			value : 5
		},
		start : {
			omplusType : "Number",
			value : 0
		}
	}
});

Omplus.base.define(Omplus.models.Model, {
	omplusName : "ReturnedFormsSearchResults",
	controller : "formsController",
	value : {
		persons : {
			omplusType : "Array",
			omplusProto : "FormsSearchModelProto"
		},
		total : {
			omplusType : "Number"
		}
	}
});

Omplus.base.define(Omplus.models.SingleChooser, {
	omplusName : "returnedChooser",
	controller : "formsController",
	omplusProto : "PersonProto",
	actions : [ {
		omplusType : "Get",
		omplusName : "insertDobijeni",
		proxy : {
			omplusType : "AjaxProxy"
		},
		responseModel : "returnedChooser.current",
		requestModel : "returnedChooser.current"
	} ]
});

Omplus.views.OpeningReturnedTabView = Omplus.base
		.extend(
				Omplus.views.OpeningTabView,
				{
					omplusType : "OpeningReturnedTabView",
					layout : {
						omplusType : "AccordionLayout"
					},
					controller : "formsController",
					components : [
							{
								omplusName : "returnedDetailsFirstPanel",
								omplusType : "AccordionPanel",
								components : [
										{
											labelModel : "Assets.list.name_label.localValue",
											model : "returnedChooser.current.s_name"
										},
										{
											labelModel : "Assets.list.last_name_label.localValue",
											model : "returnedChooser.current.s_last_name"
										},
										{
											labelModel : "Assets.list.fathers_name_label.localValue",
											model : "returnedChooser.current.s_fathers_name"
										},
										{
											labelModel : "Assets.list.birth_date_label.localValue",
											model : "returnedChooser.current.s_birth_date",
											inputType : "NewDateInput",
											maxDate : "today"
										},
										{
											labelModel : "Assets.list.birth_place_label.localValue",
											model : "returnedChooser.current.s_birth_place"
										},
										{
											labelModel : "Assets.list.birth_municipality_label.localValue",
											model : "returnedChooser.current.s_birth_municipality"
										},
										{
											labelModel : "Assets.list.living_place_label.localValue",
											model : "returnedChooser.current.s_living_place"
										},
										{
											labelModel : "Assets.list.living_municipality_label.localValue",
											model : "returnedChooser.current.s_living_municipality"
										},
										{
											labelModel : "Assets.list.living_address_label.localValue",
											model : "returnedChooser.current.s_living_address"
										},
										{
											labelModel : "Assets.list.status_sifra_opstine_label.localValue",
											model : "returnedChooser.current.status_sifra_opstine",
											datalist : "updateNewVraceniStatusList"
										},
										{
											omplusType : "DataList",
											omplusName : "updateNewVraceniStatusList",
											model : "Localization.opstine",
											valueName:"sifra",
											controller : "languageController",
											width : "0px"
										},
										{
											labelModel : "Assets.list.status_br_resenja_opstine_label.localValue",
											model : "returnedChooser.current.status_br_resenja_opstine"
										},
										{
											labelModel : "Assets.list.status_br_resenja_kirs_label.localValue",
											model : "returnedChooser.current.status_br_resenja_kirs"
										},
										{
											labelModel : "Assets.list.status_datum_donosenja_label.localValue",
											model : "returnedChooser.current.status_datum_donosenja",
											inputType : "NewDateInput",
											minDate : "1992-03-01",
											maxDate : "today",
											gt : "#formsDetailsFirstPanel_field_14_input"
										},
										{
											labelModel : "Assets.list.status_datum_zavodjenja_label.localValue",
											model : "returnedChooser.current.status_datum_zavodjenja",
											inputType : "NewDateInput",
											minDate : "1992-03-01",
											maxDate : "today",
											lt : "#formsDetailsFirstPanel_field_13_input"
										},
										{
											labelModel : "Assets.list.status_registarski_broj_label.localValue",
											model : "returnedChooser.current.status_registarski_broj"
										},
										{
											labelModel : "Assets.list.status_opstina_boravista_label.localValue",
											model : "returnedChooser.current.status_opstina_boravista"
										},
										{
											labelModel : "Assets.list.status_adresa_boravista_label.localValue",
											model : "returnedChooser.current.status_adresa_boravista"
										} ],
								controller : "languageController",
								model : "Assets.list.get_status_label.localValue"
							},
							{
								omplusName : "returnedDetailsSecondPanel",
								omplusType : "AccordionPanel",
								components : [
										{
											labelModel : "Assets.list.name_label.localValue",
											model : "returnedChooser.current.i_name"
										},
										{
											labelModel : "Assets.list.last_name_label.localValue",
											model : "returnedChooser.current.i_last_name"
										},
										{
											labelModel : "Assets.list.fathers_name_label.localValue",
											model : "returnedChooser.current.i_fathers_name"
										},
										{
											labelModel : "Assets.list.birth_date_label.localValue",
											model : "returnedChooser.current.i_birth_date",
											inputType : "NewDateInput",
											maxDate : "today"
										},
										{
											labelModel : "Assets.list.birth_place_label.localValue",
											model : "returnedChooser.current.i_birth_place"
										},
										{
											labelModel : "Assets.list.birth_municipality_label.localValue",
											model : "returnedChooser.current.i_birth_municipality"
										},
										{
											labelModel : "Assets.list.living_place_label.localValue",
											model : "returnedChooser.current.i_living_place"
										},
										{
											labelModel : "Assets.list.living_municipality_label.localValue",
											model : "returnedChooser.current.i_living_municipality"
										},
										{
											labelModel : "Assets.list.living_address_label.localValue",
											model : "returnedChooser.current.i_living_address"
										},
										{
											labelModel : "Assets.list.status_sifra_opstine_label.localValue",
											model : "returnedChooser.current.i_status_sifra_opstine",
											datalist : "updateLostVraceniStatusList"
										},
										{
											omplusType : "DataList",
											omplusName : "updateLostVraceniStatusList",
											model : "Localization.opstine",
											valueName:"sifra",
											controller : "languageController",
											width : "0px"
										},
										{
											labelModel : "Assets.list.status_br_resenja_opstine_label.localValue",
											model : "returnedChooser.current.i_status_br_resenja_opstine"
										},
										{
											labelModel : "Assets.list.status_br_resenja_kirs_label.localValue",
											model : "returnedChooser.current.i_status_br_resenja_kirs"
										},
										{
											labelModel : "Assets.list.status_datum_label.localValue",
											model : "returnedChooser.current.i_status_datum",
											inputType : "NewDateInput",
											maxDate : "today"
										},
										{
											labelModel : "Assets.list.status_opstina_boravista_label.localValue",
											model : "returnedChooser.current.i_status_opstina_boravista"
										},
										{
											labelModel : "Assets.list.status_adresa_boravista_label.localValue",
											model : "returnedChooser.current.i_status_adresa_boravista"
										},
										{
											labelModel : "Assets.list.status_mesto_boravista_label.localValue",
											model : "returnedChooser.current.i_status_mesto_boravista"
										},
										{
											labelModel : "Assets.list.status_razlog_prestanka_label.localValue",
											model : "returnedChooser.current.i_status_razlog_prestanka_statusa"
										} ],
								controller : "languageController",
								model : "Assets.list.lost_status_label.localValue"
							},
							{
								omplusName : "returnedDetailsThirdPanel",
								omplusType : "AccordionPanel",
								components : [ {
									omplusType : "Button",
									omplusName : "updatedReturnedStatusButton",
									model : "Assets.list.label_save_button.localValue",
									controller : "languageController",
									width : "300px",
									click : function() {
										Omplus.globals.getObject(
												"returnedChooser").getAction(
												"insertDobijeni").run();
									}
								} ],
								controller : "languageController",
								model : "Assets.list.actions_label.localValue"
							}

					]
				});

Omplus.base.define(Omplus.views.ManagementPanel, {
	omplusName : "returnedFormsPanel",
	controller : "formsController",
	renderTo : "managements",
	models : {
		chooser : "returnedChooser",
		search : "ReturnedFormsSearch",
		searchResult : "ReturnedFormsSearchResults",
		searchResultList : "persons",
		forDisplay : "id"
	},
	views : {
		chooser : {
			title : "Assets.list.forms_label.localValue",
			components : [ {
				omplusName : "returnedTabs",
				omplusType : "OpeningTabPanel",
				omplusProto : "OpeningReturnedTabView",
				controller : "formsController",
				model : "returnedChooser",
				showModel : "id",
				onChange : function() {
				}
			} ]
		},
		search : [ {
			// Per page
			inputType : "Select",
			model : "PerPages",
			showModel : "number",
			current : "forReturnedForms",
			controller : "languageController",
			labelModel : "Assets.list.label_per_page.localValue",
			perPage : true
		}, {
			// Search button
			inputType : "Button",
			controller : "languageController",
			model : "Assets.list.label_search_button.localValue",
			cssClasses : [ "search-button" ],
			labelWidth : "0%",
			inputWidth : "100%",
			searchButton : true
		} ],
		searchResult : [ {
			labelModel : "Assets.list.person_id_label.localValue",
			width : "100px",
			omplusType : "Label",
			model : "id"
		}, {
			labelModel : "Assets.list.name_label.localValue",
			width : "120px",
			omplusType : "Label",
			model : "s_name"
		}, {
			labelModel : "Assets.list.last_name_label.localValue",
			width : "120px",
			omplusType : "Label",
			model : "s_last_name"
		}, {
			labelModel : "Assets.list.name_label.localValue",
			width : "120px",
			omplusType : "Label",
			model : "i_name"
		}, {
			labelModel : "Assets.list.last_name_label.localValue",
			width : "150px",
			omplusType : "Label",
			model : "i_last_name"
		}, {
			labelModel : "Assets.list.dobijen_short_label.localValue",
			width : "80px",
			omplusType : "Label",
			model : "dobijeni"
		}, {
			labelModel : "Assets.list.izgubljen_short_label.localValue",
			width : "80px",
			omplusType : "Label",
			model : "izgubljeni"
		}, {
			omplusType : "Button",
			model : "Assets.list.details_label.localValue",
			width : "180px",
			controller : "languageController",
			getDetails : true,
			errorable : false
		} ]
	}
});